import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { NoteVO, NoteForm, NoteQuery } from '@/api/biz/note/types';

/**
 * 查询笔记管理列表
 * @param query
 * @returns {*}
 */

export const listNote = (query?: NoteQuery): AxiosPromise<NoteVO[]> => {
  return request({
    url: '/biz/note/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询笔记管理详细
 * @param noteId
 */
export const getNote = (noteId: string | number): AxiosPromise<NoteVO> => {
  return request({
    url: '/biz/note/' + noteId,
    method: 'get'
  });
};

/**
 * 新增笔记管理
 * @param data
 */
export const addNote = (data: NoteForm) => {
  return request({
    url: '/biz/note',
    method: 'post',
    data: data
  });
};

/**
 * 修改笔记管理
 * @param data
 */
export const updateNote = (data: NoteForm) => {
  return request({
    url: '/biz/note',
    method: 'put',
    data: data
  });
};

/**
 * 删除笔记管理
 * @param noteId
 */
export const delNote = (noteId: string | number | Array<string | number>) => {
  return request({
    url: '/biz/note/' + noteId,
    method: 'delete'
  });
};
